UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T9tmy0JfY29k5ObZ8j9RLiIu1SinpPHQYee8RJqo3Wk='
WHERE
key_id = 'd293972c285d13228155432b541c12ad8df9733adf78fa93e6f6d201372fff4c'
AND (
token = 'T9tmy0JfY29k5ObZ8j9RLiIu1SinpPHQYee8RJqo3Wk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)