UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xx6jkbiFuRC0HCU6dI7nOVszsF1R+T/5C56fNUBbDyc='
WHERE
key_id = '3b8853b6422112bc28890b1a3a459a1daae5ccd460134f9c451a3957be55f6c8'
AND (
token = 'Xx6jkbiFuRC0HCU6dI7nOVszsF1R+T/5C56fNUBbDyc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)