UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J3I6hFmVMKZw4RofPzEgn3vksutLtdky70bRFWJccrQ=' 
WHERE 
  key_id = '9ad43a268ff3b5b233ea6e5cd5250adbe965dc1df59b6720d59532c48f2ef86a' 
  AND (
    token = 'J3I6hFmVMKZw4RofPzEgn3vksutLtdky70bRFWJccrQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028