UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9vvF/fM9USkUOyMrvnfD6kVyWQ6IYxXsc/stK48LDQ=' 
WHERE 
  key_id = '989e88b241f0f30ff85c049d137c702447dfb1199ceeb689002b9ffa2e46a747' 
  AND (
    token = 'n9vvF/fM9USkUOyMrvnfD6kVyWQ6IYxXsc/stK48LDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043