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