UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8LbLPDUIMd016ZttQ+G850qFNYKl2dqWN4AEeg3you0='
WHERE
key_id = 'cb4160b4cb0b94665fad48603b6b2e71e8742e70f63317c5fa45f06f96ae8ff7'
AND (
token = '8LbLPDUIMd016ZttQ+G850qFNYKl2dqWN4AEeg3you0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)