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