UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5czeW+jQhSdQzdOw/iqX02aCNl3IVkQmFvfkAO1XQIw='
WHERE
key_id = 'ae90b5b14ccdee0ff93deae8e4df2eb2cbaf9f78d2735d95c09b219a1dd40e9d'
AND (
token = '5czeW+jQhSdQzdOw/iqX02aCNl3IVkQmFvfkAO1XQIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)