UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gqcCAGqQmC1B9+yrCCAvaUqNNk9qV1tMiEZtP+qvink='
WHERE
key_id = 'db5e8cc5cdac72288957ead308238e1e915d67ef0b9d925b82e64f30987a9dea'
AND (
token = 'gqcCAGqQmC1B9+yrCCAvaUqNNk9qV1tMiEZtP+qvink='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)