UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DgDub77lC1TJR5f0JIe/Dr3+YeYmFfDB9J35oj3ufHc='
WHERE
key_id = '8d82a39ec9b0a843bbd591a4a072214f5417f9b907338df42c9a830afc7c8d72'
AND (
token = 'DgDub77lC1TJR5f0JIe/Dr3+YeYmFfDB9J35oj3ufHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)