UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NrrA4qgesrixy+Mn6t04X0vhnOa5hul8/vecvBwfjaE=' 
WHERE 
  key_id = '861ec801d3f289348b80993c50280460b9ebf683f9539133fb5bb4fc7e0a31c7' 
  AND (
    token = 'NrrA4qgesrixy+Mn6t04X0vhnOa5hul8/vecvBwfjaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038