UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1IG6DniilJZSE03pbyAAU9OIio7aBOXg2Fsch1A1q2o='
WHERE
key_id = 'd1f1451b147d66a5554e47d9212a06476c503035e424ffd0180b8c9c2bd46302'
AND (
token = '1IG6DniilJZSE03pbyAAU9OIio7aBOXg2Fsch1A1q2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)