UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7R0HzIgShce44V3ZOIGpAZI25uJzZmXlB61Kw0FuAE='
WHERE
key_id = '693dfde52d327be3e761a04a385f73a646d0ca10fa65f182923fb49ede797a60'
AND (
token = 'a7R0HzIgShce44V3ZOIGpAZI25uJzZmXlB61Kw0FuAE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)