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