UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRtB8aMzIdngzO0C6C39cpgiYlgM97yWa0hJ/OO7fpk=' 
WHERE 
  key_id = '54b922f9d8319d9f2d3a760b06052fe44b783a70b473b935a4f1d3a31dd3087f' 
  AND (
    token = 'KRtB8aMzIdngzO0C6C39cpgiYlgM97yWa0hJ/OO7fpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052