UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MF+zCEg9t2z531xijvngiINnyZHEGldwMCZl3Y50Ty0=' 
WHERE 
  key_id = '81e708a299667d2e3f0710264cd5efcb68c6053c0c9189414a717e09f998d21e' 
  AND (
    token = 'MF+zCEg9t2z531xijvngiINnyZHEGldwMCZl3Y50Ty0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028