UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fFCa3XwDLSWXVtqCn1rsgBEh971bNXtYvl3+kRg1vr8='
WHERE
key_id = '86cf4a2f90cc27f9102172a56684cb9213011a779938be0907ac000b2ce16376'
AND (
token = 'fFCa3XwDLSWXVtqCn1rsgBEh971bNXtYvl3+kRg1vr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)