UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wkj2LGKAcnHaC+5Q7Ts4QJbTHBA1wiQCJcq9oTmbMwA='
WHERE
key_id = 'c46d5505cd861115d096213fb93bd7ee51740c9d57e67c4ad0416f8300d9e148'
AND (
token = 'Wkj2LGKAcnHaC+5Q7Ts4QJbTHBA1wiQCJcq9oTmbMwA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)