UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'as73hazWBg0pztKExsAqfs5nDsvlUYbfkrnRC2UG/sg='
WHERE
key_id = 'd323413904b523f7d2192eaa4566f7f090253aebbf21dc234d0678c5a3f9c666'
AND (
token = 'as73hazWBg0pztKExsAqfs5nDsvlUYbfkrnRC2UG/sg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)