UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wfHIyprRGn36fcNltllW8yfS7TPrsO6RBgZdyk1mt3o=' 
WHERE 
  key_id = 'cbebce03598cadfaf8d90532063dfc6edca31cfb3ad94deed07e9f0a6da1e718' 
  AND (
    token = 'wfHIyprRGn36fcNltllW8yfS7TPrsO6RBgZdyk1mt3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032