UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qXR5+PM/UqytfkfNSsy62Vr5gDXghLf63TNRc3fvDRI='
WHERE
key_id = '8bb9d3dc38d9347ef4eb5c92e6114afc8640091a06e69680f46f1ac2627b6984'
AND (
token = 'qXR5+PM/UqytfkfNSsy62Vr5gDXghLf63TNRc3fvDRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)