UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9iEKqHAwVB7qPlvzkzKpJ+LjcRm1qwk4f+Ow6aMyw7g=' 
WHERE 
  key_id = 'cfd496435d5d471c1c9b76f3835fc2f7e954613f830e3ea4aedfb3d9aaf197b9' 
  AND (
    token = '9iEKqHAwVB7qPlvzkzKpJ+LjcRm1qwk4f+Ow6aMyw7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026