UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O0WTGUjml2Nyj+qyDGTwAzY8cP89jkG7eoyUCU18G4M='
WHERE
key_id = '07d4fab56c48f6cee490458bcc33e8d909009d089b1278ae952201f4268019b4'
AND (
token = 'O0WTGUjml2Nyj+qyDGTwAzY8cP89jkG7eoyUCU18G4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)