UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KkQYfxLM78Z3xK3w+HN+VtR94Fe7W4WKlHuEDBlWuww=' 
WHERE 
  key_id = '30d9506b9fbb4b3b129c9ea964eb13ab2b4949e84a51e271c06ffbbd6d75f243' 
  AND (
    token = 'KkQYfxLM78Z3xK3w+HN+VtR94Fe7W4WKlHuEDBlWuww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043