UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'liK8MO25NLa1A8ltGvEVRffOjFLoLsEtcEGNeYdSrH8='
WHERE
key_id = '2e092ca1ac822f3745afa802e36f21905367950558e896e288b022a7016a76bf'
AND (
token = 'liK8MO25NLa1A8ltGvEVRffOjFLoLsEtcEGNeYdSrH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)