UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd6cps9zsPx7CGIpmwxqpHSA7l5fvtd3C+ZKGJT1UrFY='
WHERE
key_id = 'ee321241a12f44b9f87061ac7ecdecbdecba93d91473f816d96d3c6aec221382'
AND (
token = 'd6cps9zsPx7CGIpmwxqpHSA7l5fvtd3C+ZKGJT1UrFY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)