UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'at5ZjfyGCKczUBATYVUlp7v3gRZV0l0QIUZQJCvIYnM=' 
WHERE 
  key_id = '7522dc78568050ec8301f85113b848431908038930cdf1f8c36a3f2351607941' 
  AND (
    token = 'at5ZjfyGCKczUBATYVUlp7v3gRZV0l0QIUZQJCvIYnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087