UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5p6RyYtCPXahoJIvm80EZDUL0zP3Qxt3we5hGa7fw1Q=' 
WHERE 
  key_id = 'b973843ef78794b000dcc35eb501e917b5ed9ad5251659866736c29068ade889' 
  AND (
    token = '5p6RyYtCPXahoJIvm80EZDUL0zP3Qxt3we5hGa7fw1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030