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