UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L+bpa/keBwecP21TfoF0cUSj6hh+DCUEEG48BhAGP7M='
WHERE
key_id = '0351be9e36bdb6c5b53f54270d7bb3568d9e50701cdeebf1506a3353d9555df0'
AND (
token = 'L+bpa/keBwecP21TfoF0cUSj6hh+DCUEEG48BhAGP7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)