UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2/U0R3e7vEUaIYd8bY3Li0EbmpzCTHHHCrch3p0+mg=' 
WHERE 
  key_id = '8968ce718d1b3cc2a10d0f3d7027e0cec4783726f586729675bc04ad564059f8' 
  AND (
    token = 'E2/U0R3e7vEUaIYd8bY3Li0EbmpzCTHHHCrch3p0+mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032