UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sGz/5awWhRpv/oxVT0aGRj6zFqgrVItik19CanS8kbc='
WHERE
key_id = 'd5c4449b92a522327ef9e119fe3a84f5bbf0339fa1299547f982da9a30f7ecec'
AND (
token = 'sGz/5awWhRpv/oxVT0aGRj6zFqgrVItik19CanS8kbc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)