UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQTzd/otBe4OHfDX/j6hOblk1OZScyorI20AtAtveII=' 
WHERE 
  key_id = 'a78e11078ff6b5b9ba9c0f82e73cba4155ae1c2782a4b3bae509f94656964de8' 
  AND (
    token = 'YQTzd/otBe4OHfDX/j6hOblk1OZScyorI20AtAtveII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025