UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x0GVYcsuAtvtQGTwjTwbOe+Q4EKNG6kkv7qNj4MpCf8='
WHERE
key_id = '86d5f90bacc40878c6ee4e8a7107c08e9143cd7b532f232291772e575365cdd1'
AND (
token = 'x0GVYcsuAtvtQGTwjTwbOe+Q4EKNG6kkv7qNj4MpCf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)