UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uq7YZXZ0S4kPNPfIiX+5Bb3JaV9JTml0/UpP/JKAxn4='
WHERE
key_id = 'd66513c6cb4524f5905662084ea1b933caf166501bdd6a5cc5cfd183982a9166'
AND (
token = 'uq7YZXZ0S4kPNPfIiX+5Bb3JaV9JTml0/UpP/JKAxn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)