UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sZxw7YLQybc5NsmsxRvAjZpaVjk1SbtFS8pZTJeYhY0='
WHERE
key_id = '8d60369dda67704ff07e19947009209cc41ede8df5fa9eceb77401207e3dfbeb'
AND (
token = 'sZxw7YLQybc5NsmsxRvAjZpaVjk1SbtFS8pZTJeYhY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)