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