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