UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7PW2caiGWRlJEf6CLs4aZacBYHmis4TF6TBoOIi+B8I='
WHERE
key_id = 'a37e99c70065e81c94d72274de4967799166b67701e8195485668db075877b65'
AND (
token = '7PW2caiGWRlJEf6CLs4aZacBYHmis4TF6TBoOIi+B8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)