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