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