UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V0PkBXS01qcXb2RWp9NbN2H7WzhYreQEg85kroklAtQ='
WHERE
key_id = 'bee309ceb418b4df98e8879ca0783a0be0b6b586f863dd04b3fb00ff5411083f'
AND (
token = 'V0PkBXS01qcXb2RWp9NbN2H7WzhYreQEg85kroklAtQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)