UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o2eR9OtvxNYdgZ30YkyBzf1Fg9jSngocYNISge/Nn+g=' 
WHERE 
  key_id = '6dcbdd8fe102a385e50f3b317511f02059d9355070268b90ce0c5a547d0a5442' 
  AND (
    token = 'o2eR9OtvxNYdgZ30YkyBzf1Fg9jSngocYNISge/Nn+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035