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