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