UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4zL6uaKz8fxisOITPYARoQDq8j3vjB3V3YjidGd6fEs='
WHERE
key_id = 'd9c497d77e7e5008311fe200c9b5932df6383cfbf858b5a364550aa835f9d689'
AND (
token = '4zL6uaKz8fxisOITPYARoQDq8j3vjB3V3YjidGd6fEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)